$(document).ready(function(){
    $("#auto").click(function(){
        $("#addForm").attr("action", "/add/auto");
        $("#addForm").submit();
    });

    $("#param").click(function(){
        $("#addForm").attr("action", "/add/param");
        $("#addForm").submit();
    });

    $("#model").click(function(){
        $("#addForm").attr("action", "/add/model");
        $("#addForm").submit();
    });

    $("#body").click(function(){
        const jobNo = $("#jobNo").val();
        const name = $("#name").val();
        const department = $("#department").val();
        const customer = {
            jobNo: jobNo,
            name: name,
            department: department
        };
        $.ajax({
            url: "/add/body",
            type: "POST",
            contentType: "application/json",
            data: JSON.stringify(customer),
            success: function(data){
                $("#result").html(JSON.stringify(data));
            }
        });
    });
});